# snappy.cmake
# 本文件包含着从外部导入 snappy 所需要的信息

INCLUDE(ExternalProject)

set(SNAPPY_ROOT ${PROJECT_SOURCE_DIR}/extern_module_download/snappy)
set(SNAPPY_GIT_URL      https://atomgit.com/dangaldb/Snappy-Mirror.git)  # 指定git仓库地址
set(SNAPPY_CONFIGURE    cd ${SNAPPY_ROOT}/src/extern_snappy/ && rm -rf build && git submodule update --init && mkdir build)
set(SNAPPY_MAKE         cd ${SNAPPY_ROOT}/src/extern_snappy/build && cmake ..)
set(SNAPPY_INSTALL      cd ${SNAPPY_ROOT}/src/extern_snappy/build && make) 

ExternalProject_Add(extern_snappy
        PREFIX            ${SNAPPY_ROOT}
        GIT_REPOSITORY    ${SNAPPY_GIT_URL}
        CONFIGURE_COMMAND ${SNAPPY_CONFIGURE}
        BUILD_COMMAND     ${SNAPPY_MAKE}
        INSTALL_COMMAND   ${SNAPPY_INSTALL}
        CMAKE_ARGS
        -DCMAKE_INSTALL_PREFIX=${SNAPPY_ROOT}/output
        -DBUILD_SHARED_LIBS=OFF
)